package com.ewing.graphqltest.service;

import com.ewing.graphqltest.dao.UserJpaRepository;
import com.ewing.graphqltest.model.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserService {
    @Autowired
    private UserJpaRepository userJpaRepository;

    public List<UserEntity> findAll(){
        return userJpaRepository.findAll();
    }

    public UserEntity findById(Integer id){
        return userJpaRepository.findById(id).get();
    }
}
